

<%@ page contentType="text/html;charset=UTF-8" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="layout" content="main" />
        <title>Edycja operacji</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><g:link class="list" controller="commitment" action="list" id="${commitment?.user?.id}">Historia konta</g:link></span>
            <span class="menuButton"><g:link class="list" controller="commitmentType" action="create">Nowy typ operacji</g:link></span>
        </div>

        <div class="body">
            <h1>Edycja operacji na koncie ${commitment?.user}</h1>
            <g:if test="${flash.message}">
                <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${commitment}">
                <div class="errors">
                    <g:renderErrors bean="${commitment}" as="list" />
                </div>
            </g:hasErrors>

            <g:form method="post" controller="commitment">
                <input type="hidden" name="id" value="${commitment?.id}" />
                <div class="dialog">
                    <table>
                        <tbody>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="commitmentTypeId">Typ:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:commitment,field:'commitmentTypeId','errors')}">
                                    <g:select name="commitmentTypeId"
                                    from="${CommitmentType.list()}"
                                    value="${commitment?.commitmentType?.id}"
                                    optionKey="id"
                                    id="commitmentTypeId"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="value">Brykiety:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:commitment,field:'value','errors')}">
                                    <input type="text" id="value" name="value" value="${commitment?.value?.encodeAsHTML()}"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="description">Uwagi:</label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean:commitment,field:'description','errors')}">
                                    <textarea id="description" name="description">${commitment?.description?.encodeAsHTML()}</textarea>
                                </td>
                            </tr>

                        </tbody>
                    </table>
                </div>

                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" value="Aktualizuj" action="update" /></span>
                    <span class="button"><g:actionSubmit class="delete" onclick="return confirm('Are you sure?');" value="Usuń" action="delete" /></span>
                </div>

            </g:form>
        </div>
    </body>
</html>
